<?php $this->load->view('common/cms-head'); ?>
<article id="content">
    <div class="pgwrapper">
    <div class="w960 bg1 p15 bx_shw">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td width="20%" style="border-right: 2px solid #e5e5e5;" valign="top">
		<?php $this->load->view('enterprises/leftnavCMS'); ?>
		</td>
		<td width="80%"><form enctype="multipart/form-data"
				action="/addCoupon"  onsubmit="return validateForm()" method="POST">
				<table width="100%" border="0" cellpadding="5" cellspacing="0"
					style="padding-left: 20px;">
					<tr>
						<td class="txt-blck">Select Store:</td>
						 <td><select id="code_store" name="code_store[]" multiple="multiple" style="width: 200px;height:100px;" onChange="storeredirectCheck()" class="setBgInput">
			                	<?php foreach ($allStoresArray as $temp){ ?>
								<option value="<?php echo $temp['store_id']; ?>">
								<?php echo $temp['store_name']; ?>
								</option>
								<?php } ?>		                	
			            	</select></td>
					</tr>
					<tr>
						<td class="txt-blck" width="30%">Coupon Title:</td>
						<td width="70%"><input type="text" value="" name="coupon_name"
							id="coupon_name" class="setBgInput"   />
						</td>
					</tr>
					<tr>
						<td class="txt-blck" width="30%">Coupon Code	:</td>
						<td width="70%"><input type="text" value="" name="coupon_code"
							id="coupon_code" class="setBgInput"   />
						</td>
					</tr>
					<tr>
						<td class="txt-blck">Coupon Status:</td>
						<td><select id="coupon_status" name="coupon_status" style="width:90px;padding-top:5px;" class="setBgInput">
								<option value="no status">No Status</option>
								<option value="Process">Process</option>
								<option value="Yes">Yes</option>
								<option value="No">No</option>
						</select></td>
					</tr>
					<tr>
						<td class="txt-blck">Coupon Off By:</td>
						<td width="70%"><input type="text" value="" name="coupon_offby"
							id="coupon_offby" class="setBgInput" style="width:100px;"   />
						</td>
					</tr>
					<tr>
						<td class="txt-blck">Coupon Off In:</td>
						<td><select id="coupon_offin" name="coupon_offin" style="width:90px;padding-top:5px;" class="setBgInput">
								<option value="Rupees">Rupees</option>
								<option value="Percentage">Percentage</option>
						</select></td>
					</tr>
					<tr>
						<td class="txt-blck" width="30%">Coupon Image	:</td>
						<td width="70%"><input type="file" name="coupon_image"
							id="coupon_image" class="setBgInput"   />
						</td>
					</tr>
					<tr>
						<td class="txt-blck" width="30%">Coupon Offer Only	:</td>
						<td width="70%"><select id="coupon_offer_only" name="coupon_offer_only" style="width:90px;padding-top:5px;" class="setBgInput">
                                <option value="No">No</option>
								<option value="Yes">Yes</option>
						</select>
						</td>
					</tr>
					<tr>
						<td class="txt-blck">Coupon Type:</td>
						<td><select id="coupon_type" name="coupon_type" style="width:90px;padding-top:5px;" class="setBgInput">
                                <option value="Offer">Offers</option>
								<option value="TopCpn">Top Coupons</option>
								<option value="FeaturedCpn">Featured Coupons</option>
								<option value="Cpn">Coupons</option>
						</select></td>
					</tr>
					<tr>
						<td class="txt-blck">Coupon Category:</td>
						<td><select id="coupon_cat" name="coupon_cat" style="width:90px;padding-top:5px;" class="setBgInput">
                                <option value="0">None</option>
                                <?php foreach($allCategoriesArray as $temp){ ?>
								<option value="<?php echo $temp['category_id']; ?>"><?php echo $temp['category_name']; ?></option>
                                <?php } ?>
						</select></td>
					</tr>
					<tr>
						<td valign="top" class="txt-blck">Coupon Description:</td>
						<td><textarea style="width: 450px; height: 300px;" class="setBgInput"
								id="coupon_description" name="coupon_description"></textarea></td>
					</tr>
					<tr id="imgLarge">
						
					</tr>
					<tr>
						<td valign="top" class="txt-blck" id="affurl_title">Coupon Affliate URL:</td>
						<td>
							<div id="check_deep">
								<input type="checkbox" name="editURL" id="editURL" value="1"
									onclick="activeCAU();" class="setBgInput" /> Deep Link URL
							</div>
							
						<!-- 	<div id="radioDiv" style="display:none;">
								<input type="radio" name="omg" id="omg" onclick="insertTrack(1)" /> OMG
								<input type="radio" name="tc" id="tc" onclick="insertTrack(2)" /> Trootrac
								<input type="radio" name="ty" id="ty" onclick="insertTrack(3)" /> Tyroo
							</div> -->
							
							<div id="affliateURLDiv">
                                
                                <input type="text" name="coupon_affilateurl" id="coupon_affilateurl" style="width: 320px" value=""	readonly class="setBgInput" />
							</div>
							
							<div id="utmsrc" style="display:none;">
								<input type="text" name="utmSource" id="utmSource" style="width: 400px"  value="" class="setBgInput"
								onblur="if(this.value=='') this.value='Enter UTM Source Code Here..';" onfocus="if(this.value=='Enter UTM Source Code Here..')this.value='';" value="Enter UTM Source Code Here.." />
							</div>
							
						</td>
					</tr>
					<tr>
						<td valign="top" class="txt-blck">Coupon Start Date:</td>
						<td><input type="text" name="coupon_startdate" id="coupon_startdate" style="width: 100px"
							onfocus="javascript:NewCssCal('coupon_startdate','yyyymmdd','arrow',false,'24',false);"
							value=""
							readonly class="setBgInput" /> (yyyy/mm/dd)</td>
					</tr>
					<tr>
						<td valign="top" class="txt-blck">Coupon Expire Date:</td>
						<td><input type="text" name="coupon_expiredate" id="coupon_expiredate" style="width: 100px"
							onfocus="javascript:NewCssCal('coupon_expiredate','yyyymmdd','arrow',false,'24',false);"
							value=""
							readonly class="setBgInput" /> (yyyy/mm/dd)</td>
					</tr>
					<tr>
						<td></td>
						<td><input type="submit" name="code_submit" value="Submit" class="btn_bg" /></td>
					</tr>
				</table>
			</form></td>
	</tr>
</table>
</div>
</div>
</article>
<div class="clr-both spacer-10">&nbsp;</div>
<?php $this->load->view('common/cms-footer'); ?>
<script>
function activeCAU() {
	if (document.getElementById("editURL").checked) {
		document.getElementById("coupon_affilateurl").removeAttribute(
				"readonly")
	} else {
		document.getElementById("coupon_affilateurl").setAttribute("readonly",
				"readonly")
	}
}
function validateForm(){
	var s = document.getElementById('code_store').value;
	if(s==""){
	alert("You must choose a store.");
	document.getElementById('code_store').focus();
	return false;
	}
	var x = document.getElementById('coupon_name').value;
	if(x==""){
	alert("Coupon Title must be filled out.");
	return false;
	}
	var o = document.getElementById('coupon_offby').value;
	if(o==""){
	alert("Coupon off by must be filled out.");
	return false;
	}
}
	
</script>

	